#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char* argv[])
{
    if(argc < 2) {
        printf("filename: %s\n", argv[0]);
        exit(1);
    }
    
    int ret = access(argv[1], W_OK);
    if(-1 == ret) {
        perror("Access");
        exit(1);
    }
    
    printf("You can write this file.\n");
    return 0;
}

